package BeadSort;

public class Counter implements Runnable{
	private int[][] abacus;
	
	public void run()
	{
		count();
	}
	
	public Counter(){
		int[][]arr=new int[0][0];  //create blank array
		int[]arrby=new int[0];
		arrby[0]=0;
		arr[0] = arrby; //set blank array data to 0
		this.abacus=arr;
	}
	
	public Counter(int[][] abacus)
	{
		this.abacus=abacus;
	}
	
	private int[] count() //One bead! Ah ah ah!
	{
		int count=0;
		int[] arr=new int[abacus[0].length];
		
		for(int x=0; x<abacus[0].length; x++)
		{
			for(int y=0; y<abacus.length; y++)
			{
				if(abacus[y][x]==1)
					count++;
			}
			arr[x]=count;
			count=0;
		}
		return arr;
	}
}